/**
   Copyright 2013 Фроловский А. В.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
   
   This file is a part of MyStats project
 */

package foo.mystats.db;

import android.database.sqlite.SQLiteDatabase;

public class DataTable {
  public static final String TABLE_DATA = "data";
  public static final String COLUMN_ID = "id";
  public static final String COLUMN_ROW_ID = "row_id";
  /**
   * Unix epoch time
   */
  public static final String COLUMN_DATETIME = "datetime";
  public static final String COLUMN_VALUE = "value";

  private static final String SQL_CREATE = "CREATE TABLE " + TABLE_DATA + " (\r\n" +
      COLUMN_ID + " INTEGER PRIMARY KEY,\r\n" +
      COLUMN_ROW_ID + " INTEGER NOT NULL REFERENCES '" + RowTable.TABLE_ROW + "'('id') ON DELETE CASCADE,\r\n" +
      COLUMN_DATETIME + " INTEGER NOT NULL,\r\n" +
      COLUMN_VALUE + " NONE NOT NULL\r\n" +
      ");";

  public static void onCreate(SQLiteDatabase db) {
    db.execSQL(SQL_CREATE);
  }

  public static void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  }
}
